<!DOCTYPE html>
<html lang="zh-CN">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>新闻详情 - 广州桦霖气体有限公司</title>
  <link rel="stylesheet" href="assets/css/common.css">
  <script src="assets/js/common.js"></script>
</head>
<body>
  <header id="header"></header>

  <main class="container">
    <article class="news-detail">
      <h1 id="newsTitle" style="margin-bottom:0.5rem;">新闻标题</h1>
      <div class="news-meta" id="newsDate" style="color:#7f8c8d;margin-bottom:2rem;"></div>
      <div id="newsContent">
        <p>新闻内容加载中...</p>
      </div>
    </article>
    
    <div class="margin-top-2" style="padding-top:1rem;border-top:1px solid #eee;">
      <a href="news.html" class="btn-small">← 返回新闻列表</a>
    </div>
  </main>

  <footer id="footer"></footer>

  <script src="assets/js/data.js"></script>
  <script>
    // 获取URL参数
    const urlParams = new URLSearchParams(window.location.search);
    const id = parseInt(urlParams.get('id'));
    
    // 查找新闻数据
    const data = news.find(n => n.id === id);
    
    if(data) {
      document.getElementById('newsTitle').textContent = data.title;
      document.getElementById('newsDate').textContent = data.date;
      document.getElementById('newsContent').innerHTML = data.content;
    } else {
      document.getElementById('newsContent').innerHTML = '<p>未找到新闻内容</p>';
    }
    
    // 页面加载完成后创建导航
    document.addEventListener('DOMContentLoaded', function() {
      document.getElementById('header').innerHTML = createNav('news');
      document.getElementById('footer').innerHTML = createFooter();
    });
  </script>
</body>
</html>